<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core" xmlns:o="http://omnifaces.org/ui" xmlns:p="http://primefaces.org/ui">

<h:form id="formMenuTop">
	<div class="navbar navbar-inverse navbar-fixed-top">
      <div class="container">
        <div class="navbar-header">
          <h:commandLink action="/home" class="navbar-brand" value="#{text['menu.top.home']}"/>
        </div>
        <div class="navbar-collapse collapse" id="navbar-main">
          <ul class="nav navbar-nav">
	            <li class="dropdown">
	              <a class="dropdown-toggle" data-toggle="dropdown" href="#" id="eleve">#{text['menu.top.eleve']}<span class="caret"></span></a>
	              <ul class="dropdown-menu" aria-labelledby="eleve">
	                <li><h:commandLink rendered="#{p:ifGranted('ROLE_ADMIN')}" action="#{eleveController.viewEleveForm}" value="#{text['menu.top.eleve.add']}"/></li>
	                <li><h:commandLink rendered="#{p:ifGranted('ROLE_ADMIN')}" action="#{paiementController.edit}" value="#{text['menu.top.paiement.add']}"/></li>
	                <li><h:commandLink action="/eleves" value="#{text['menu.top.eleve.list']}"/></li>
	                <li><h:commandLink action="/import.xhtml" value="#{text['menu.admin.import.eleves']}"/></li>
	              </ul>
	            </li>
	            
	            <h:panelGroup layout="block" rendered="#{p:ifGranted('ROLE_ADMIN')}">
					<li class="dropdown">
		              <a class="dropdown-toggle" data-toggle="dropdown" href="#" id="classes">#{text['menu.top.classe']}<span class="caret"></span></a>
		              <ul class="dropdown-menu" aria-labelledby="classes">
	             	    <li><h:commandLink action="/classes" value="#{text['menu.admin.classes']}"/></li>
	             	    <li><h:commandLink action="/groupes" value="#{text['menu.admin.classe.groupes']}"/></li>
		              </ul>
		            </li>
	           </h:panelGroup>
	           
	           <h:panelGroup layout="block" rendered="#{p:ifGranted('ROLE_ADMIN')}">
					<li class="dropdown">
		              <a class="dropdown-toggle" data-toggle="dropdown" href="#" id="classes">#{text['menu.admin.anneeScolaire.top']}<span class="caret"></span></a>
		              <ul class="dropdown-menu" aria-labelledby="classes">
	             	    <li><h:commandLink action="/anneeScolaires" value="#{text['menu.admin.anneeScolaires']}"/></li>
	             	    <li><h:commandLink action="/startAnneeScolaire.xhtml" value="#{text['menu.admin.start.anneeScolaire']}"/></li>
		              </ul>
		            </li>
	           </h:panelGroup>
	           
	            <h:panelGroup layout="block" rendered="#{p:ifGranted('ROLE_ADMIN')}">
					<li class="dropdown">
		              <a class="dropdown-toggle" data-toggle="dropdown" href="#" id="administration">#{text['menu.top.admin']}<span class="caret"></span></a>
		              <ul class="dropdown-menu" aria-labelledby="administration">
		                <li><h:commandLink action="/admin/users" value="#{text['menu.admin.users']}"/></li>
		                <li><h:commandLink action="/admin/activeUsers" value="#{text['home.activeUsers']}"/></li>
		                <li><h:commandLink action="/admin/reload" value="#{text['menu.admin.reload']}"/></li>
		              </ul>
		            </li>
	           </h:panelGroup>
	           
	           	<li>
	           		<h:commandLink action="/recettes.xhtml" value="#{text['menu.top.recettes']}"/>
	           	</li>
	            
			</ul>
          <ul class="nav navbar-nav navbar-right">
            <li style="top: 10px; right: 50%">
                <h:selectOneMenu id="anneeScolaire" styleClass="form-control input-sm"
					value="#{appController.anneeScolaire.id}">
					<f:selectItem itemLabel="#{text['form.select']}" itemValue="" />
					<f:selectItems value="#{appController.anneeScolaires}"	var="anneeScolaire" 
					itemLabel="#{anneeScolaire.anneeScolaire}" itemValue="#{anneeScolaire.id}" />
					<p:ajax partialSubmit="true" update="@all" listener="#{appController.handleAnneeScolaireChange}"/>
				</h:selectOneMenu>
			</li>
            
            <li>
            	<a href="#{request.contextPath}/?locale=fr"> #{text['webapp.local.fr']}</a>
            </li>
            
            <li>
	            <a href="#{request.contextPath}/?locale=ar"> #{text['webapp.local.ar']}</a>
            </li>
            
            <li class="dropdown">
              <a class="dropdown-toggle" data-toggle="dropdown" href="#" id="profile">#{text['menu.profil']}<span class="caret"></span></a>
              <ul class="dropdown-menu" aria-labelledby="profile">
                <li>
                	<a href="#{facesContext.externalContext.requestContextPath}/logout">#{text['user.logout']}</a>
                </li>
                <li><h:commandLink action="/editProfile" value="#{text['menu.user']}"/></li>
              </ul>
            </li>
          </ul>

        </div>
      </div>
    </div>
</h:form>
</html>